package com.train.course.service.impl;

import java.util.List;

import com.train.course.domain.VideoCategory;
import com.train.common.utils.DateUtils;
import com.train.course.mapper.VideoCategoryMapper;
import com.train.course.service.IVideoCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 视频分类Service业务层处理
 * 
 * @author train
 * @date 2025-10-20
 */
@Service
public class VideoCategoryServiceImpl implements IVideoCategoryService
{
    @Resource
    private VideoCategoryMapper videoCategoryMapper;

    /**
     * 查询视频分类
     * 
     * @param categoryId 视频分类主键
     * @return 视频分类
     */
    @Override
    public VideoCategory selectVideoCategoryByCategoryId(Long categoryId)
    {
        return videoCategoryMapper.selectVideoCategoryByCategoryId(categoryId);
    }

    /**
     * 查询视频分类列表
     * 
     * @param videoCategory 视频分类
     * @return 视频分类
     */
    @Override
    public List<VideoCategory> selectVideoCategoryList(VideoCategory videoCategory)
    {
        return videoCategoryMapper.selectVideoCategoryList(videoCategory);
    }

    /**
     * 新增视频分类
     * 
     * @param videoCategory 视频分类
     * @return 结果
     */
    @Override
    public int insertVideoCategory(VideoCategory videoCategory)
    {
        videoCategory.setCreateTime(DateUtils.getNowDate());
        return videoCategoryMapper.insertVideoCategory(videoCategory);
    }

    /**
     * 修改视频分类
     * 
     * @param videoCategory 视频分类
     * @return 结果
     */
    @Override
    public int updateVideoCategory(VideoCategory videoCategory)
    {
        videoCategory.setUpdateTime(DateUtils.getNowDate());
        return videoCategoryMapper.updateVideoCategory(videoCategory);
    }

    /**
     * 批量删除视频分类
     * 
     * @param categoryIds 需要删除的视频分类主键
     * @return 结果
     */
    @Override
    public int deleteVideoCategoryByCategoryIds(Long[] categoryIds)
    {
        return videoCategoryMapper.deleteVideoCategoryByCategoryIds(categoryIds);
    }

    /**
     * 删除视频分类信息
     * 
     * @param categoryId 视频分类主键
     * @return 结果
     */
    @Override
    public int deleteVideoCategoryByCategoryId(Long categoryId)
    {
        return videoCategoryMapper.deleteVideoCategoryByCategoryId(categoryId);
    }
}
